/**
 * Copyright ©2012-2018 HopeHaiyang Corporation, All Rights Reserved
 * http://www.wuhanhope.com
 */
package hope.platform.data.server.data.img;

import hope.platform.data.dao.HopeExceptionKindRepository;
import hope.platform.data.domain.HopeExceptionKind;
import hope.platform.data.server.data.header.HopeExceptionKindService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * class info
 *
 * @author hujia
 *         Create at 2018/7/20 15:30
 */
@Service
public class HopeExceptionKindServiceImg implements HopeExceptionKindService {

    @Autowired
    private HopeExceptionKindRepository repository;

    @Override
    public List<HopeExceptionKind> getAll() {
        return repository.findAll();
    }

    @Override
    public HopeExceptionKind getByExceptionType(String exceptionType) {
        return repository.findByExceptionType(exceptionType);
    }

    @Override
    public HopeExceptionKind addHopeExceptionKind(HopeExceptionKind hopeExceptionKind) {
        hopeExceptionKind.setGmtCreate(new Date());
        hopeExceptionKind.setGmtModified(new Date());
        return repository.save(hopeExceptionKind);
    }
}
